#include <retro.h>
#include "player.frame.h"

INT CALLBACK _tWinMain(
  __in  HINSTANCE hInstance,
  __in  HINSTANCE hPrevInstance,
  __in  LPTSTR lpCmdLine,
  __in  INT nCmdShow)
{
    INT wNumArgs;
    PTSTR* wArgs = CommandLineToArgvW(GetCommandLine(), &wNumArgs);

    InitCommonControls();
    CoInitialize(NULL);
    Windows::initWindows();

    Retro::Initialize(FALSE);
    Retro::Player::Frame::start(
      wNumArgs >= 2 ? wArgs[1] : NULL,
      nCmdShow == SW_HIDE);
    Retro::Uninitialize();

    Windows::uninitWindows();
    CoUninitialize();

    return EXIT_SUCCESS;
}
